package com.atguigu.rabbitmq.eight;

import com.atguigu.rabbitmq.utils.RabbitMqUtils;
import com.rabbitmq.client.BuiltinExchangeType;
import com.rabbitmq.client.Channel;

import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;

/**
 * ClassName: Consumer02
 * Description: 死信队列 实战
 * 消费者2
 * Date: 2023/04/28 PM 3:57:30
 * <p>
 * project: atguigu-rabbitmq
 * package: com.atguigu.rabbitmq.eight
 * email: 1085844536@qq.com
 * version:
 *
 * @author WangGuojian
 */
public class Consumer02 {

    /**
     * 死信队列的名称
     */
    public static final String DEAD_QUEUE = "dead_queue";

    public static void main(String[] args) throws Exception {
        Channel channel = RabbitMqUtils.getChannel();
        System.out.println("等待接收消息......");
        channel.basicConsume(DEAD_QUEUE, true, (consumerTag, message) -> {
            System.out.println("Consumer02接收的消息是：" + new String(message.getBody(), StandardCharsets.UTF_8));
        }, consumerTag -> {
        });
    }

}
